package subtractProductAndSum;

public class Solution {
    public int subtractProductAndSum(int n) {
        int sum = 0;
        int num = 1;
        while(n>0){
            int t = n%10;
            sum+=t;
            num*=t;
            n/=10;
        }
        return num-sum;
    }
}
